home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 4 / Apprentice-Release4.iso / Demos / AppMaker 2.0b3 / Demo AppMaker 1.5 / Demo AppMaker™ / Demo AppMaker™.rsrc / TmPT_303_zDoc < prev    next >
Encoding:
Text File  |  1992-04-08  |  3.2 KB  |  151 lines

  1. { %filename% -- document methods }
  2. { Created %date% %time% by AppMaker }
  3.  
  4. {    We recommend that you not modify this module and instead modify        }
  5. {    its subclass, %Appname%Doc.  The 'z' prefix on this module marks%    %}
  6. {    a module which is likely to be regenerated by AppMaker after you    }
  7. {    make changes to the user interface.  The modules without the 'z'    }
  8. {    prefix will not be regenerated by AppMaker unless you delete them.    }
  9. {    Using a separate subclass to override the AppMaker-generated code    }
  10. {    lets you regenerate code without losing your hand-coded changes.    } 
  11.  
  12. Unit %unitname%;
  13. Interface
  14.  
  15. Uses
  16.     TCL,
  17.     AMCL,
  18.     %AppName%Intf,
  19.     %if fileExists appname+Doc.p%
  20.         %for each dialog gen usesDocDialogs%
  21.     %endif%
  22.     ResourceDefs;
  23.  
  24. {----------}
  25. Implementation
  26.  
  27. {----------}
  28. Procedure Z%Appname%Doc.I%Appname%Doc    (aSupervisor:    CApplication;
  29.                                          printable:        Boolean);
  30. Begin
  31.     inherited IDocument (aSupervisor, printable);
  32.     itsData := nil;
  33.  
  34. End; {I%Appname%Doc}
  35.  
  36. {----------}
  37. Procedure Z%Appname%Doc.Free;
  38. Begin
  39.     ForgetObject (itsData);
  40.     itsFile := nil;        {was disposed by ForgetObject (itsData) }
  41.     inherited Free;
  42. End; {Free}
  43.  
  44. {----------}
  45. Procedure Z%Appname%Doc.NewFile;
  46. Begin
  47.     New (itsData);
  48.     itsData.I%Appname%Data (self);
  49.  
  50.     BuildWindows;
  51.  
  52.     if itsWindow <> nil then begin
  53.         itsWindow.Select;
  54.     end;
  55. End; {NewFile}
  56.  
  57. {----------}
  58. Procedure Z%Appname%Doc.OpenFile    (macSFReply:    SFReply);
  59. var
  60.     theName:        Str255;
  61. Begin
  62.     New (itsData);
  63.     itsData.I%Appname%Data (self);
  64.     itsData.SFSpecify (macSFReply);
  65.     itsData.OpenData (fsRdWrPerm);
  66.     itsFile := itsData;
  67.  
  68.     BuildWindows;
  69.  
  70.     itsFile.GetName (theName);
  71.     if itsWindow <> nil then begin
  72.         itsWindow.SetTitle (theName);
  73.         itsWindow.Select;
  74.     end;
  75. End; {OpenFile}
  76.  
  77. {----------}
  78. Procedure Z%Appname%Doc.BuildWindows;
  79. %for each window gen instance%
  80. Begin
  81.     %for each window gen create%
  82.  
  83. End; {BuildWindows}
  84.  
  85. {----------}
  86. Function Z%Appname%Doc.DoSave: Boolean;
  87. Begin
  88.     if itsFile = nil then begin
  89.         DoSave := DoSaveFileAs;
  90.     end else begin
  91.         if itsData.Save then begin
  92.             dirty := false;
  93.             DoSave := true;
  94.         end else begin
  95.             DoSave := false;
  96.         end;
  97.     end;
  98. End; {DoSave}
  99.  
  100. {----------}
  101. Function Z%Appname%Doc.DoSaveAs    (macSFReply:    SFReply): Boolean;
  102. Begin
  103.     if itsData.SaveAs (macSFReply) then begin
  104.         itsFile := itsData;
  105.         if itsWindow <> nil then begin
  106.             itsWindow.SetTitle (macSFReply.fName);
  107.         end;
  108.         dirty := false;
  109.         DoSaveAs := true;
  110.     end else begin
  111.         DoSaveAs := false;
  112.     end;
  113. End; {DoSaveAs}
  114.  
  115. {----------}
  116. Procedure Z%Appname%Doc.DoRevert;
  117. Begin
  118.     itsData.Revert;
  119.     dirty := false;
  120.  
  121. End; {DoRevert}
  122.  
  123. %if fileExists appname+Doc.p%
  124.     {----------}
  125.     { This code should be in %Appname%Doc.p rather than in this file. }
  126.     { AppMaker generated it here because %Appname%Doc.p already existed. }
  127.     { AppMaker doesn't overwrite an existing non-Z file because it }
  128.     { might have lots of user hand-written code. }
  129.     {----------}
  130.     Procedure Z%Appname%Doc.UpdateMenus;
  131.     Begin
  132.         inherited UpdateMenus;
  133.         %for each menu gen updateDocMenus%
  134.     
  135.     End; {UpdateMenus}
  136.     
  137.     {----------}
  138.     Procedure Z%Appname%Doc.DoCommand    (theCommand:     longint);
  139.     Begin
  140.         case theCommand of
  141.             0:    ;
  142.             %for each menu gen handleDocItems%
  143.     
  144.             otherwise
  145.                 inherited DoCommand (theCommand);
  146.         end; {case}
  147.     End; {DoCommand}
  148.  
  149. %endif%
  150. End. {%unitname%}
  151.